package com.itheima.d4_print_stream;

import java.io.*;
import java.nio.charset.Charset;

/*
    目标：掌握打印流：PrintStream/PrintWriter的用法。
 */
public class PrintTest1 {
    public static void main(String[] args) throws IOException {
        //支持字节流
        PrintStream ps = new PrintStream(new FileOutputStream("test.txt",true));

        ps.println(12);
        ps.print("上海啊");
        //支持字符流，但最后后需要刷新流或关闭流
        PrintWriter pw = new PrintWriter(new FileWriter("test.txt",true));
        pw.println("上海黑马集训中心");

        pw.close();

//---------------------------
        //打印特定编码的内容
        PrintWriter pw2 = new PrintWriter("test.txt+", Charset.forName("GBK"));



    }
}
